import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
typedef ItemCallback = void Function(int index);
class UIUtil {
  static _buildShareItem(img, name) {
    return GestureDetector(
      child: Column(
        children: <Widget>[
          Image.asset(img, width: 48, height: 48),
          Padding(
            padding: EdgeInsets.only(top: 10),
            child: Text(name),
          )
        ],
      ),
      onTap: () {
        Fluttertoast.showToast(msg: name);
      },
    );
  }

  static share(BuildContext context) {
    showModalBottomSheet(
        context: context,
        builder: (BuildContext context) {
          return Container(
            padding: EdgeInsets.all(15),
            height: 120,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: <Widget>[
                _buildShareItem('res/images/ic_wx.png', '微信'),
                _buildShareItem('res/images/ic_wx_moment.png', '朋友圈'),
                _buildShareItem('res/images/ic_weibo.png', '微博'),
              ],
            ),
          );
        });
  }
}